package gui;

import javax.swing.JPanel;
import javax.swing.WindowConstants;
import javax.swing.tree.TreePath;
import domein.DomeinController;
import java.awt.BorderLayout;
import java.util.List;
import java.util.Map;

public class ReisplanFrame extends javax.swing.JFrame {
	private DomeinController domeinController;
	private TreePath[] locaties;
	private JPanel pnlPanel;

	public ReisplanFrame(DomeinController domeinController, TreePath[] locaties) {
		super();
		this.domeinController = domeinController;
		this.locaties = locaties;
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setBackground(new java.awt.Color(90, 116, 142));
			BorderLayout thisLayout = new BorderLayout();
			getContentPane().setLayout(thisLayout);
			this.setResizable(false);
			this.setLocation(new java.awt.Point(300, 200));
			{
				pnlPanel = new ReisplanOverzichtPanel(domeinController, this, locaties);
				getContentPane().add(pnlPanel, BorderLayout.CENTER);
				pnlPanel.setPreferredSize(new java.awt.Dimension(10, 10));
				pnlPanel.setBorder(null);
			}
			pack();
			this.setSize(600, 390);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void showResult(List<String> routes, TreePath[] locaties) {
		getContentPane().removeAll();

		JPanel pnlResultaat = new ReisplanOverzichtResultatenPanel(domeinController, routes, locaties);
		getContentPane().add(pnlResultaat, BorderLayout.CENTER);
		getContentPane().invalidate();
		getContentPane().repaint();
	}
}
